class Storage {
    setStorage(key, value) {
        window.localStorage.setItem(key, value)
    }
    getStorage(key) {
        if (typeof key === 'string') {
            return window.localStorage.getItem(key) || ''
        }
        if (key instanceof Array) {
            const setKey = [...new Set(key)]
            let newObj = {}
            setKey.forEach(item => {
                const value = window.localStorage.getItem(item) || ''
                if (value) {
                    newObj[item] = value
                }
            })
            return newObj
        }
    }
}
//get方法支持字符串和数组
//字符串返回字符串  数组返回对象
export default new Storage()